package com.sunwayhorizo.health.ets.base.persistent;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

@Entity
@TableGenerator(name = "CodingScheme_IdGenerator", table = "ET_Id_Generator", pkColumnName = "pkColumn", valueColumnName = "valueColumn", pkColumnValue = "CodingScheme_Id")
@NamedQuery(name = "EtCodingSchemes.findAll", query = "select o from EtCodingSchemes o")
//@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@Table(name = "ET_CODING_SCHEMES")
public class EtCodingSchemes implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.TABLE, generator = "CodingScheme_IdGenerator")
	@Column(name = "CODINGSCHEME_ID", nullable = false)
	private String codingschemeId;
	
	@Column(name = "CODINGSCHEME_OID")
	private String codingschemeOid;
	
	@Column(name = "CODINGSCHEME_CH_NAME", nullable = false)
	private String codingschemeChName;
	
	@Column(name = "CODINGSCHEME_EN_NAME", nullable = false)
	private String codingschemeEnName;
	
	@Column(name = "CODINGSCHEME_DESC")
	private String codingschemeDesc;
	
	@Column(name = "EDITABLE_FLAG", nullable = false)
	private String editableFlag;
	
	//@Column(name = "MODEL_NAME", nullable = false)
	//private String modelName;

	@Column(name = "CREATED_BY", nullable = false)
	private Long createdBy;
	
	@Column(name = "CREATED_BY_NAME", nullable = false)
	private String createdByName;
		
	@Column(name = "CREATION_DATE", nullable = false)
	private Timestamp creationDate;
	
	@Column(name = "LAST_UPDATED_BY", nullable = false)
	private Long lastUpdatedBy;
	
	@Column(name = "LAST_UPDATED_BY_NAME", nullable = false)
	private String lastUpdatedByName;
	
	@Column(name = "LAST_UPDATE_DATE", nullable = false)
	private Timestamp lastUpdateDate;
	
	@Column(name = "LAST_UPDATE_LOGIN")
	private Long lastUpdateLogin;
	
	@Column(name = "INPUT_PY")
	private String pinyinCode;
	
	@Column(name = "INPUT_WB")
	private String wubiCode;

	@Column(name = "COMPLEXABLE")
	private String complexable;
	
	@OneToMany(mappedBy = "etCodingSchemes")
	private List<EtVersions> etVersionsList = new ArrayList<EtVersions>();
	
	@ManyToOne
	@JoinColumn(name = "MODEL_NAME")
	private EtModels etModels;

	public EtCodingSchemes() {
		Long i = new Long(1);
		Timestamp nowTime = new Timestamp(new Date().getTime());

		createdBy = i;
		creationDate = nowTime;
		lastUpdatedBy = i;
		lastUpdateDate = nowTime;
		lastUpdateLogin = i;

	}

	public String getCodingschemeDesc() {
		return codingschemeDesc;
	}


	public String getComplexable() {
		return complexable;
	}

	public void setComplexable(String complexable) {
		this.complexable = complexable;
	}

	public void setCodingschemeDesc(String codingschemeDesc) {
		this.codingschemeDesc = codingschemeDesc;
	}

	public String getCodingschemeId() {
		return codingschemeId;
	}

	public void setCodingschemeId(String codingschemeId) {
		this.codingschemeId = codingschemeId;
	}

	public String getCodingschemeChName() {
		return codingschemeChName;
	}

	public void setCodingschemeChName(String codingschemeChName) {
		this.codingschemeChName = codingschemeChName;
	}

	public String getCodingschemeEnName() {
		return codingschemeEnName;
	}

	public void setCodingschemeEnName(String codingschemeEnName) {
		this.codingschemeEnName = codingschemeEnName;
	}

	public String getCodingschemeOid() {
		return codingschemeOid;
	}

	public void setCodingschemeOid(String codingschemeOid) {
		this.codingschemeOid = codingschemeOid;
	}

	public Long getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(Long createdBy) {
		this.createdBy = createdBy;
	}

	public Timestamp getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Timestamp creationDate) {
		this.creationDate = creationDate;
	}

	public String getEditableFlag() {
		return editableFlag;
	}

	public void setEditableFlag(String editableFlag) {
		this.editableFlag = editableFlag;
	}

	public Long getLastUpdatedBy() {
		return lastUpdatedBy;
	}

	public void setLastUpdatedBy(Long lastUpdatedBy) {
		this.lastUpdatedBy = lastUpdatedBy;
	}

	public Timestamp getLastUpdateDate() {
		return lastUpdateDate;
	}

	public void setLastUpdateDate(Timestamp lastUpdateDate) {
		this.lastUpdateDate = lastUpdateDate;
	}

	public Long getLastUpdateLogin() {
		return lastUpdateLogin;
	}

	public void setLastUpdateLogin(Long lastUpdateLogin) {
		this.lastUpdateLogin = lastUpdateLogin;
	}

	/*
	public String getModelName() {
		return modelName;
	}

	public void setModelName(String modelName) {
		this.modelName = modelName;
	}*/

	public List<EtVersions> getEtVersionsList() {
		return etVersionsList;
	}

	public void setEtVersionsList(List<EtVersions> etVersionsList) {
		this.etVersionsList = etVersionsList;
	}

	public EtVersions addEtVersions(EtVersions etVersions) {
		getEtVersionsList().add(etVersions);
		etVersions.setEtCodingSchemes(this);
		return etVersions;
	}

	public EtVersions removeEtVersions(EtVersions etVersions) {
		getEtVersionsList().remove(etVersions);
		etVersions.setEtCodingSchemes(null);
		return etVersions;
	}

	public String getCreatedByName() {
		return createdByName;
	}

	public void setCreatedByName(String createdByName) {
		this.createdByName = createdByName;
	}

	public String getLastUpdatedByName() {
		return lastUpdatedByName;
	}

	public void setLastUpdatedByName(String lastUpdatedByName) {
		this.lastUpdatedByName = lastUpdatedByName;
	}

	public String getPinyinCode() {
		return pinyinCode;
	}

	public void setPinyinCode(String pinyinCode) {
		this.pinyinCode = pinyinCode;
	}

	public String getWubiCode() {
		return wubiCode;
	}

	public void setWubiCode(String wubiCode) {
		this.wubiCode = wubiCode;
	}

	
	public EtModels getEtModels() {
		return etModels;
	}

	public void setEtModels(EtModels etModels) {
		this.etModels = etModels;
	}

	
	
	
}
